<?php
class Item_Section_color extends MY_Controller{
	var $folder = "admin";
	function __construct(){
		parent::__construct();
		$this->load->model($this->folder.'/Item_section_color_model' , 'mItemSectionColor' ,TRUE);
		$this->mainmodel = $this->mItemSectionColor;
		$this->postConstructor();
	}
	
	function loadCustomReferenceData($data = array()){
		$this->load->model($this->folder.'/Item_section_model' , 'mItemSection' ,TRUE);
		$this->load->model($this->folder.'/Item_color_model' , 'mItemColor' ,TRUE);
		//echo "(".$data['query_value'];
		   // if($this->action == "")
		    $sectionList = array();
			if(isset($data['query_value'])){
			 	$sectionList = $this->mItemSection->mainListWithPaginationByField("item_id" , $data['query_value']);
			 	forEach($sectionList as $_section){
			 		$section = $this->mItemSectionColor->mainListWithPaginationByField("item_section_id" , $_section['id']);
			 		$data['item_section_color_section_'.$_section['id']] = $section;
			 	}
			}
		 	 $data['availableColors'] = $section = $this->mItemColor->mainListWithPagination();
			 $data['itemSectionList'] = $sectionList;
		return $data;
	}
}
?>